import { createRouter, createWebHistory } from 'vue-router'
import LoginHome from '../views/Login_Home.vue'
import Login from '../components/Login/Login.vue'
import Register from '../components/Login/Register.vue'
import HomeItem from '../components/HomeItem/HomeItem'
import UpdateUserPwd from '../components/UpdateUseInfo/UpdateUserPwd'
import UpdateUserName from '../components/UpdateUseInfo/UpdateUserName'
import VoteHistory from "../components/VoteHistory/VoteHistory"
import Home from '../views/Home.vue'
import Vote from '../views/Vote.vue'
import VoteEdit from '../views/VoteEdit.vue'
import VoteDetail from '../views/VoteDetail.vue'
const routes = [
  {
    path: '',
    name: 'LoginHome',
    component: LoginHome,
    redirect:"/login",
    children:[
      {
        path: 'login',
        name: 'Login',
        component: Login
      },
      {
        path: 'register',
        name: 'Register',
        component: Register
      },
    ]
  },
  {
    path:'/home',
    name:'Home',
    component:Home,
    children:[
      {
        path:"",
        name:"HomeItem",
        component:HomeItem
      },
      {
        path:'updatePwd',
        name:'UpdateUserPwd',
        component:UpdateUserPwd
      },
      {
        path:'VoteHistory',
        name:'VoteHistory',
        component:VoteHistory
      },
      {
        path:'updateName',
        name:'UpdateUserName',
        component:UpdateUserName
      },
    ]
  },
  {
    path:'/vote',
    name:'Vote',
    component:() => import(/* webpackChunkName: "about" */ '../views/Vote.vue')
  },
  {
    path:'/VoteEdit/:type',
    name:'VoteEdit',
    component:VoteEdit
  },
  {
    path:'/VoteDetail/:id',
    name:'VoteDetail',
    component:VoteDetail
  },

  // {
  //   path: '/about',
  //   name: 'About',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  // }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
